package com.atguigu.edu.pubshier.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface FavorableRateMapper {

    @Select("select course_name name,\n" +
            "nvl(cast(sum(review_user_count)/sum(good_review_user_count)*10 as DECIMAL(16,2)),0) value\n" +
            "from dws_interaction_review_window partition par#{date} group by course_name;")
    List<Map<String, BigDecimal>> selectFavorableRate(@Param("date") Integer date);
}
